package com.store.bookstore_backend.service.impl;

import com.store.bookstore_backend.domain.Book;
import com.store.bookstore_backend.mapper.BookMapper;
import com.store.bookstore_backend.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    BookMapper bookMapper;

    public List<Book> getAllBooks() {
        return bookMapper.selectAllBooks();
    }

    @Override
    public Book showBook(int id) {
        return bookMapper.selectBookById(id);
    }

    @Override
    public List<Book> findByCategory(int id) {
        return bookMapper.selectBookByCategory(id);
    }

    @Override
    public List<Book> findByQuery(String query) {
        return bookMapper.selectBookByName(query);
    }

}
